""windows manager
" Use <space> + new arrow keys for moving the cursor around windows
"map <LEADER>w <C-w>w
"map <LEADER>u <C-w>k
"map <LEADER>e <C-w>j
"map <LEADER>n <C-w>h
"map <LEADER>i <C-w>l
""map <LEADER>r <C-w>r
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
nmap <C-f> :NERDTreeToggle<CR>

" Define mappings
nnoremap <leader>u :UndotreeToggle<cr>

" === vim-signiture
" let g:SignatureMap = {
" 			\ 'Leader'             :  "m",
" 			\ 'PlaceNextMark'      :  "m,",
" 			\ 'ToggleMarkAtLine'   :  "m.",
" 			\ 'PurgeMarksAtLine'   :  "dm-",
" 			\ 'DeleteMark'         :  "dm",
" 			\ 'PurgeMarks'         :  "dm/",
" 			\ 'PurgeMarkers'       :  "dm?",
" 			\ 'GotoNextLineAlpha'  :  "m<LEADER>",
" 			\ 'GotoPrevLineAlpha'  :  "",
" 			\ 'GotoNextSpotAlpha'  :  "m<LEADER>",
" 			\ 'GotoPrevSpotAlpha'  :  "",
" 			\ 'GotoNextLineByPos'  :  "",
" 			\ 'GotoPrevLineByPos'  :  "",
" 			\ 'GotoNextSpotByPos'  :  "mn",
" 			\ 'GotoPrevSpotByPos'  :  "mp",
" 			\ 'GotoNextMarker'     :  "",
" 			\ 'GotoPrevMarker'     :  "",
" 			\ 'GotoNextMarkerAny'  :  "",
" 			\ 'GotoPrevMarkerAny'  :  "",
" 			\ 'ListLocalMarks'     :  "m/",
" 			\ 'ListLocalMarkers'   :  "m?"
" 			\ }


let mapleader =" "
let maplocalleader =","
"nmap <leader>e :vsplit<CR>
"nmap <leader>a :FZF<CR>
nmap <leader>p :Paste<CR>
vmap <leader>p :Paste<CR>
vmap <leader>yy "+y
nmap <leader>o 0v$"+y
nmap <LEADER>rc :e ~/.config/nvim/init.vim<CR> 
"COC shortcut
nmap <LEADER>q :q<CR>
nmap <LEADER>w :w<CR>
"map <LEADER>u :bl<CR>
"map <LEADER>i :bn<CR>
"nmap <LEADER>j i<CR><ESC>
"map <LEADER>kr :source ~/.vimrc<CR> 
"map <LEADER>kk :e ~/.vim/plug-config/hotkey.vim<CR> 
"map <LEADER>kw :w<CR> 
"map <LEADER>b :CocList --top maps<CR>
"map <LEADER>s :Translate<CR>
"删除特殊符号和空行 
"map <LEADER>qa :g/^\s*$/d<CR> 
"map <LEADER>qm :%s/^M//gg<CR>
"map <LEADER>qn :%s/\n//gg<CR>
"nmap <leader>qd gg=G
nmap <leader>qc vg_
nmap <leader>eb :let i=1 \| .,+10g/^/ s//\=i/ \| let i+=1 <c-a> 
"map <leader>qq :q<CR>
nmap <leader>[ o<Esc>
nnoremap <leader>lj :
"nmap <leader>fw :CocCommand fzf-preview.Buffers<CR>
"nmap <leader>fd :Files<CR>
"nmap <leader>fr :CocFzfList<CR>
"nmap <leader>ff :BLines<CR>
"nmap <leader>fj :Rg<CR>
"nmap <leader>fb :Lines<CR>
"打开历史文件	 
nmap <leader>h :Startify<CR>
"leader config-------
"其他快捷键
"" 前后标签
"nmap tu :tabnew<CR>
"nmap tn :+tabnext<CR>
"nmap tp :-tabnext<CR>
"nmap <leader>bn :bnext<CR>
"nmap <leader>bp :bprevious<CR>
"调整窗口大小
nmap <down> :resize+3<CR>
nmap <up> :resize-3<CR>
nmap <right> :vertical resize-3<CR>
nmap <left> :vertical resize+3<CR>
nmap gt vg_ 
nmap <leader>0 :lua require'floaterm'.open({name='floaterm',layout='center',height=0.7,width=0.6})<CR>
" set
nmap <leader>o :lua require'floaterm'.open({name='FileBrowser',layout='center',height=0.7,width=0.6,command='lf'})<CR>
" search visual select text
vnoremap // y/\V<C-R>=escape(@",'/\')<CR><CR>
vnoremap uu <Esc>
" coc-translator
nmap <Leader>ts <Plug>(coc-translator-p)
nmap <Leader>tc :CocCommand 
nmap <Leader>tl :CocList 
vmap <Leader>ts <Plug>(coc-translator-pv)
" Up and down used ctrl+j, ctrl+k and so on.
cnoremap <C-j> <Down>
cnoremap <C-k> <Up>
cnoremap <C-a> <Home>
cnoremap <C-e> <End>
cnoremap <C-b> <Left>
cnoremap <C-f> <Right>
cnoremap <C-d> <Del>
cnoremap <C-h> <BS>
"localleader  with telescope 
" Find files using Telescope command-line sugar.
nnoremap <leader>sf <cmd>Telescope find_files<cr>
nnoremap <leader>sg <cmd>Telescope live_grep<cr>
nnoremap <leader>sb <cmd>Telescope buffers<cr>
nnoremap <leader>sh <cmd>Telescope help_tags<cr>
nnoremap <leader>sb <cmd>:lua require('telescope.builtin').live_grep({prompt_title = 'find string in open buffers...' , grep_open_files = true})<cr>
"yode-nvim setting hotkey
"map <Leader>fk      :YodeCreateSeditorFloating<CR>
"map <Leader>fl :YodeCreateSeditorReplace<CR>
"nmap <Leader>bd :YodeBufferDelete<cr>
"imap <Leader>bd <esc>:YodeBufferDelete<cr>
" these commands fall back to overwritten keys when cursor is in split window
"map <C-W>r :YodeLayoutShiftWinDown<CR>
"map <C-W>R :YodeLayoutShiftWinUp<CR>
"map <C-W>J :YodeLayoutShiftWinBottom<CR>
"map <C-W>K :YodeLayoutShiftWinTop<CR>
vnoremap <Leader>tt y/<c-r>"<cr>
nnoremap f :HopWord<cr>
nnoremap F :HopChar1<cr>
nnoremap <leader>9 :ToggleTerm<cr>
